package chulixuan.foundation.flowControl;

import java.util.Scanner;

/**
 * 由键盘输入三个整数分别存入变量num1、num2、num3，对它们进行排序(使用 if-else if-else)，并且从小到大输出。
 */
public class Demo0000000004 {
    public static void main(String[] args) {
        System.out.println("请输入第一个变量");
        Scanner scanner = new Scanner(System.in);
        int num1 = scanner.nextInt();
        System.out.println("请输入第二个变量");
        int num2 = scanner.nextInt();
        System.out.println("请输入第三个变量");
        int num3 = scanner.nextInt();
        if (num1 >= num2) {

            if (num3 >= num1)
                System.out.println(num2 + "-" + num1 + "-" + num3);
            else if (num3 <= num2)
                System.out.println(num3 + "-" + num2 + "-" + num1);
            else
                System.out.println(num2 + "-" + num3 + "-" + num1);
        } else { //num1 < num2

            if (num3 >= num2) {
                System.out.println(num1 + "-" + num2 + "-" + num3);
            } else if (num3 <= num1) {
                System.out.println(num3 + "-" + num1 + "-" + num2);
            } else {
                System.out.println(num1 + "-" + num3 + "-" + num2);
            }
        }

    }
}
